package com.karaku.karaku_collector.collector.model;

import java.util.ArrayList;
import java.util.List;

import io.agora.rtc.Constants;

/**
 * Created by guoping on 2017/11/7.
 */

public class VideoProfile {
    public int profile;
    public String name;
    public String size;
    public int frameRate;
    public int bitrate;

    public VideoProfile() {
    }

    public VideoProfile(int profile, String name, String size, int frameRate, int bitrate) {
        this.profile = profile;
        this.name = name;
        this.size = size;
        this.frameRate = frameRate;
        this.bitrate = bitrate;
    }

    private static List<VideoProfile> ps;
    public static List<VideoProfile> getProfiles() {
        if (ps == null) {
            ps = new ArrayList<>();
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_360P, "360P", "640x360", 15, 400));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_360P_3, "360P_3", "360x360", 15, 260));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_360P_4, "360P_4", "640x360", 30, 600));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_360P_6, "360P_6", "360x360", 30, 400));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_360P_7, "360P_7", "480x360", 15, 320));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_360P_8, "360P_8", "480x360", 30, 490));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_360P_9, "360P_9", "640x360", 15, 800));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_360P_10, "360P_10", "640x360", 24, 800));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_360P_11, "360P_11", "640x360", 24, 1000));

            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_480P, "480P", "640x480", 15, 500));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_480P_3, "480P_3", "480x480", 15, 400));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_480P_4, "480P_4", "640x480", 30, 750));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_480P_6, "480P_6", "480x480", 30, 600));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_480P_8, "480P_8", "848x480", 15, 610));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_480P_9, "480P_9", "848x480", 30, 930));

            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_720P, "720P", "1280x720", 15, 1130));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_720P_3, "720P_3", "1280x720", 30, 1710));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_720P_5, "720P_5", "960x720", 15, 910));
            ps.add(new VideoProfile(Constants.VIDEO_PROFILE_720P_6, "720P_6", "960x720", 30, 1380));
        }
        return ps;
    }
    
    public static VideoProfile getProfile(int profile) {
        for (VideoProfile vp : getProfiles()) {
            if (vp.profile == profile) {
                return vp;
            }
        }
        return null;
    }
}
